Optical reading device

ABSTRACT

Even if a size of a read image is large, a code search process can be speeded up to enable immediate output of a decoding result. Each time a predetermined number of lines of image data is taken, a pre-processing circuit executes pre-processing on the image data and calculates a characteristic amount indicating the likelihood of the code for each area in the image data. A processor determines a code candidate area based on the acquired characteristic amount and executes a decoding process of the determined area to generate a decoding result.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application claims foreign priority based on Japanese Patent Application No. 2020-049425, filed Mar. 19, 2020, the contents of which are incorporated herein by reference.

BACKGROUND OF THE INVENTION 1. Field of the Invention

The present aspect relates to an optical reading device that reads information included in a read image generated by capturing an image of a workpiece.

2. Description of Related Art

In general, a code reader configured to be capable of capturing an image of a code, such as a bar code and a two-dimensional code, attached to a workpiece with a camera, cutting and binarizing the code included in the obtained image by image processing, and reading information by a decoding process (see, for example, Japanese Patent Laid-Open No. 2018-136860 and Japanese Patent Laid-Open No. 2012-64178).

An optical reading device in Japanese Patent Laid-Open No. 2018-136860 is configured to set an upper limit of an exposure time for reading a code based on a moving speed of a workpiece and a cell size constituting the code, and acquire and analyze a plurality of images including the code to automatically set the exposure time within the upper limit.

An optical reading device of Japanese Patent Laid-Open No. 2012-64178 includes a first core that causes an imaging unit to execute imaging processing and transfers acquired image data to a shared memory and a second core that reads the image data from the shared memory and executes a decoding process based on a decoding process request from the first core.

Meanwhile, a reading process in the optical reading device as in Japanese Patent Laid-Open No. 2018-136860 or Japanese Patent Laid-Open No. 2012-64178 generally includes three processes of pre-processing for performing various filtering processes and the like, a code search process of scanning the entire pre-processed image to search for an area where a code is likely to exist, and a decoding process of decoding using image data of the area identified by the code search process.

Further, while the pre-processing is often implemented in a dedicated circuit or a programmable logic device (PLD), the code search process and the decoding process are hardly constructed with a simple image manipulation process, and are not mountable in a dedicated circuit or PLD, and thus, are executed by a processor.

Meanwhile, in a distribution center, for example, conveyed objects (workpieces) having various sizes and shapes are conveyed at high speed, and there is a demand for an increase of a size of a read image in order to reliably capture a code under such a circumstance. When the size of the read image becomes large, it takes a lot of time for the code search process. That is, the code search process is a process of extracting and calculating a characteristic amount for evaluation of likelihood of a code while scanning the entire image, and thus, it takes time for scanning if the image size is increased, and as a result, there is a possibility that output of a decoding result may be delayed.

The present invention has been made in view of this point, and an object thereof is to enable speed up a code search process and enable immediate output of a decoding result even if a size of a read image is large.

SUMMARY OF THE INVENTION

In order to achieve the above object, the present disclosure is intended for a stationary optical reading device that reads a code attached to a workpiece being conveyed on a line. The optical reading device includes: an illumination unit that emits light toward an area through which the workpiece passes; an imaging unit configured to receive the light emitted from the illumination unit and reflected from the area through which the workpiece passes, to generate a read image obtained by capturing the area through which the workpiece passes, and to transfer the read image line by line; a pre-processing circuit that executes pre-processing of image data each time a predetermined number of lines of the image data is taken from the imaging unit, and calculates a characteristic amount indicating likelihood of the code for each area in the pre-processed image data based on a brightness value of each pixel in the pre-processed image data; a processor that acquires the characteristic amount calculated by the pre-processing circuit, determines a code candidate area in the read image based on the acquired characteristic amount, and executes a decoding process of the determined area to generate a decoding result; and an output unit that outputs the decoding result generated by the processor.

With this configuration, when the workpiece conveyed on the line is irradiated with light from the illumination unit, the light reflected on the workpiece is received by the imaging unit, and the read image including the workpiece and the code attached to the workpiece is generated. The generated read image is transferred to the pre-processing circuit line by line. When taking a predetermined number of lines of image data, the pre-processing circuit executes pre-processing on the image data and calculates a characteristic amount indicating the likelihood of the code for each area in the pre-processed image data. The characteristic amount can be a combination of edge data. The processor determines a code candidate area in the read image based on the calculated characteristic amount, and executes a decoding process of the determined area.

In other words, the characteristic amount indicating the likelihood of the code is calculated while capturing the image data for each line from the imaging unit, the code candidate area is determined based on this characteristic amount, and the decoding process of the determined area is executed. Thus, it is unnecessary to wait until scanning of the entire image ends to search for the code, and it is possible to perform the capturing of the image data from the imaging unit, the calculation of the characteristic amount, and the determination of the code candidate area in parallel. As a result, the output timing of the decoding result can be accelerated even if the size of the read image is large.

The pre-processing circuit may be, for example, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), or the like.

According to another embodiment of the invention, the pre-processing circuit generates a characteristic amount image to which the brightness value corresponding to the calculated characteristic amount is assigned after calculating the characteristic amount, and the processor acquires the characteristic amount image generated by the pre-processing circuit, and determines a code candidate area based on the acquired characteristic amount image.

With this configuration, the pre-processing circuit generates the characteristic amount image to which the brightness value corresponding to the characteristic amount is assigned. In the characteristic amount image, the brightness value of the pixel differs between an area with a large characteristic amount and an area with a small characteristic amount, and thus, the processor can identify the area having the large characteristic amount based on the brightness value of the pixel. As a result, the accuracy at the time of determining the code candidate area is enhanced. In the characteristic amount image, an area with a large characteristic amount can be displayed brighter or darker than an area with a small characteristic amount, so that a so-called heat map image can be obtained.

According to still another embodiment of the invention, the pre-processing circuit calculates a first characteristic amount indicating likelihood of a first code and a second characteristic amount indicating a likelihood of a second code, and then, generates a first characteristic amount image to which a brightness value corresponding to the first characteristic amount is assigned and a second characteristic amount image to which a brightness value corresponding to the second characteristic amount is assigned, and the processor determines a candidate area for the first code based on the first characteristic amount image generated by the pre-processing circuit, determines a candidate area for the second code based on the second characteristic amount image, and executes a decoding process of each of the determined areas to generate a decoding result.

For example, there is a case where one read image includes the first code and the second code. In this case, it is possible to generate the first characteristic amount image to which the brightness value corresponding to the first characteristic amount indicating the likelihood of the first code is assigned and the second characteristic amount image to which the brightness value corresponding to the second characteristic amount indicating the likelihood of the second code is assigned, and the candidate area for the first code and the candidate area for the second code can be determined based on these characteristic amount images.

According to still another embodiment of the invention, the processor has a plurality of cores that acquire the first characteristic amount image and the second characteristic amount image, respectively, and executes the decoding processes using the respective cores.

With this configuration, the decoding processes of the first code and the second code can be executed in parallel, and thus, the processing speed can be increased.

According to still another embodiment of the invention, the processor has a plurality of cores configured to execute a code decoding process, and each of the plurality of cores includes a first decoding processing unit that acquires the first characteristic amount image, and a second decoding processing unit that acquires the second characteristic amount image. The first decoding processing unit can execute a decoding process of the first characteristic amount image. The second decoding processing unit can execute a decoding process of the second characteristic amount image.

In other words, since the first decoding processing unit that acquires the first characteristic amount image and the second decoding processing unit that acquires the second characteristic amount image are provided, the process of acquiring the first characteristic amount image and the process of acquiring the second characteristic amount image can be performed in parallel. In addition, each of the first decoding processing unit and the second decoding processing unit may be a thread for a decoding process in a core.

According to still another embodiment of the invention, the first code is a one-dimensional code and the second code is a two-dimensional code.

With this configuration, when one read image includes the one-dimensional code and the two-dimensional code, an area including the one-dimensional code and an area including the two-dimensional code can be determined separately.

According to still another embodiment of the invention, the pre-processing circuit executes edge detection processing on the image data taken from the imaging unit to generate edge data, and then, generates the characteristic amount image based on the edge data.

With this configuration, it is possible to generate the edge data by executing the edge detection processing on the image data taken from the imaging unit, and the code candidate area becomes clearer by generating the characteristic amount image based on this edge data. The edge detection processing can be executed using, for example, a Sobel filter or the like. For example, a composite image may be generated by adding or the like for the X-direction Sobel and the Y-direction Sobel if a rotation angle of a bar code is 0° and 90°, respectively, and for the X-direction Sobel and Y-direction Sobel images if there is no premise for the rotation angle of the bar code.

In addition, examples of the edge data can include an edge strength image, an edge angle image, and the like, and further, an image obtained by executing common convolution processing or arithmetic processing may be used. In addition, not only first-order differential processing but also second-order differential processing can be used as the edge detection processing.

According to still another embodiment of the invention, the pre-processing circuit executes an edge data integration process of integrating edge data of a certain pixel and a vicinity of the pixel after generating the edge data, and then, generates the characteristic amount image.

With this configuration, for example, an area where pixels having large brightness values gather in the edge data can be presumed as the code candidate area. It is possible to express the area where the pixels having large brightness values gather by integrating the edge data of the certain pixel and its vicinity constituting the edge data. In other words, it is possible to execute a product-sum calculation process or a pixel integration process configured to generate data for measuring the degree of gathering of edge data within a certain area.

Specifically, a smoothing process that has an effect of adding pixel values within a specific window size can be used. In addition, a reduction process may be used. When the reduction process is used, the amount of data of the characteristic amount image decreases, so that there is an advantage that the amount of scanning can be small.

According to still another embodiment of the invention, the pre-processing circuit executes a process of adding brightness values of pixels having a substantially similar edge direction within a certain range and subtracting pixel values of pixels having different edge directions as the edge data integration process before generation of the first characteristic amount image to which the brightness value corresponding to likelihood of the one-dimensional code is assigned, so that the candidate area for the one-dimensional code can be obtained with high accuracy.

According to still another embodiment of the invention, the pre-processing circuit executes a process of adding pixel values of pixels having different edge directions within a certain range as the edge data integration process before generation of the second characteristic amount image to which the brightness value corresponding to likelihood of the two-dimensional code is assigned, so that the candidate area for the two-dimensional code can be obtained with high accuracy.

According to still another embodiment of the invention, the pre-processing circuit can execute at least one of a gradation conversion process and a filtering process as the pre-processing.

As described above, according to the present disclosure, the pre-processing can be executed each time the pre-processing circuit takes the predetermined number of lines of image data, and the characteristic amount indicating the likelihood of the code can be calculated for each area in the pre-processed image data. The processor can determine the code candidate area based on the characteristic amount, and execute the decoding process of the determined area to generate the decoding result. Thus, the code search process can be speeded up and the decoding result can be output immediately even if the size of the read image is large.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a view illustrating the operation time of an optical reading device according to an embodiment of the present aspect;

FIG. 2 is a view illustrating an example of a workpiece on which a one-dimensional code and a two-dimensional code have been attached;

FIG. 3 is a block diagram of the optical reading device;

FIG. 4 is a block diagram illustrating a detailed structure of a processing unit provided in the optical reading device;

FIG. 5 is a front view of the optical reading device;

FIG. 6 is a view of the optical reading device as viewed from an operation button side;

FIG. 7 is a view of the optical reading device as viewed from a terminal side;

FIG. 8 is a view illustrating a display example of a parameter set;

FIG. 9 is a flowchart illustrating an example of a code search data generation process when there is only one type of code;

FIG. 10A is a view illustrating an example of a read image;

FIG. 10B is a view illustrating an example of a one-dimensional code heat map image;

FIG. 10C is a view illustrating an example of a two-dimensional code heat map image;

FIG. 11 is a flowchart illustrating an example of a code search data generation process when there are two types of codes;

FIG. 12 is a timing chart illustrating an example of a case where a decoding process is executed on a plurality of read images;

FIG. 13 is a conceptual diagram in a case where a plurality of read images are processed in parallel by a plurality of threads in a plurality of cores;

FIG. 14 is a conceptual diagram in a case where a plurality of read images are processed in parallel by one threads in a plurality of cores;

FIG. 15 is a flowchart in a case where a core that has completed the decoding process is instructed to perform the next decoding process;

FIG. 16 is a view illustrating a queue state of each core that executes a decoding process and an instruction timing of a decoding process to each core;

FIG. 17 is a flowchart illustrating a tuning procedure;

FIG. 18 is a timing chart of a fixed interval imaging mode;

FIG. 19 is a timing chart in a case where imaging is not performed at fixed intervals;

FIG. 20 is a flowchart illustrating a process procedure when waiting for a free core;

FIG. 21 is a flowchart illustrating a process procedure in a case where a buffer capable of storing image data is provided;

FIG. 22 is a timing chart illustrating an operation example after a decoding process is completed;

FIG. 23 is a flowchart illustrating an operation example after a decoding process is completed;

FIG. 24 is a timing chart in a case where a plurality of read images generated by changing brightness of an illumination unit are subjected to decoding processes by different cores;

FIG. 25 is a timing chart in a case where different types of codes included in a plurality of read images generated by changing brightness of an illumination unit are subjected to decoding processes by different cores;

FIG. 26 is a flowchart illustrating processing during the operation time of the optical reading device; and

FIG. 27 is a view illustrating an example of a user interface image.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

Hereinafter, an embodiment of the present aspect will be described in detail with reference to the drawings. Note that the following description of the preferred embodiment is merely an example in essence, and is not intended to limit the present aspect, its application, or its use.

FIG. 1 is a view schematically illustrating the operation time of an optical reading device 1 according to the embodiment of the present aspect. In this example, a plurality of workpieces W are conveyed in a direction of arrow Y in FIG. 1 in the state of being placed on an upper surface of a conveying belt conveyor B, the optical reading device 1 according to the embodiment is installed at a place separated upward from the workpieces W. The workpiece W sometimes flows not only in the central portion of the upper surface of the conveying belt conveyor B in a width direction but also on one side and the other side in the state of being offset in the width direction, and the workpiece W does not always pass through a fixed position.

The optical reading device 1 can be used, for example, in a distribution center or the like. Conveyed objects (workpieces W) having various sizes and shapes are conveyed at high speed on the conveying belt conveyor B installed in the distribution center. In addition, an interval between the workpieces W in a conveying direction is also set to be narrow. Further, the workpiece W has a plurality of codes CD1 and CD2 attached thereto in some cases, but has only one code attached thereto in other cases.

In this example, types of the first code CD1 and the second code CD2 are different, the first code CD1 is a one-dimensional code, and the second code CD2 is a two-dimensional code. A typical example of the first code CD1 is a bar code, and examples thereof can include a JAN code, an ITF code, GS1-128, and the like. Typical examples of the second code CD2 are a QR code (registered trademark), a micro QR code, a data matrix (data code), a Veri code, an Aztec code, PDF 417, a Maxi code, and the like. The second code CD2 has a stack type and a matrix type, and the present aspect can be applied to any two-dimensional code. The first code CD1 and the second code CD2 may be attached by printing or engraving directly on the workpiece W, may be attached by being pasted to the workpiece W after being printed on a label or the like, and any mechanism or method may be used. In addition, a plurality of one-dimensional codes or a plurality of two-dimensional codes may be attached to the workpiece W. Although it is assumed that the first code CD1 and the second code CD2 are attached to the workpiece W in the following description, the present aspect is not applied by being limited to such a code attachment form, and can be also applied to a form in which only one code or three or more codes are attached.

As illustrated in FIG. 1, the optical reading device 1 is a device that optically reads the first code CD1 and the second code CD2 (illustrated in FIG. 2) attached to the workpiece W, and is specifically a code reader configured to capture the images of the first code CD1 and the second code CD2 attached to the workpiece W to generate a read image, and to be capable of executing a decoding process of the first code CD1 and the second code CD2 included in the generated read image and outputting a decoding result.

The optical reading device 1 can be configured as a stationary optical reading device that is used in the state of being fixed to a bracket or the like (not illustrated) so as not to move during its operation, but may be operated while being gripped and moved by a robot (not illustrated) or a user. In addition, the first code CD1 and the second code CD2 of the workpiece W in the stationary state may be read by the optical reading device 1. The operation time is the time during which an operation of reading the first codes CD1 and the second codes CD2 of the workpieces W sequentially conveyed by the conveying belt conveyor B is performed. The optical reading device 1 of the present embodiment is suitable for a situation where it is desired to read the first code CD1 and the second code CD2 attached to the workpiece W whose position varies, but it not limited thereto, and can be also used even in the case of reading the first code CD1 and the second code CD2 attached to the workpiece W whose position does not vary.

As illustrated in FIG. 1, the optical reading device 1 is connected to a computer 100 and a programmable logic controller (PLC) 101 as external control devices in a wired manner by signal lines 101 a and 101 a, respectively. However, the aspect is not limited thereto, and the optical reading device 1, the computer 100, and the PLC 101 may have built-in communication modules to wirelessly connect the optical reading device 1 with the computer 100 and the PLC 101. The PLC 101 is a control device configured for sequence control of the conveying belt conveyor B and the optical reading device 1, and can use a general-purpose PLC.

The computer 100 can use a general-purpose or dedicated electronic computer, a portable terminal, or the like. In this example, a so-called personal computer is used, and includes a control unit 40, a storage device 41, a display unit 42, an input unit 43, and a communication unit 44. As the optical reading device 1 is downsized, it is difficult to make the entire setting of the optical reading device 1 using only the display unit 7, buttons 8 and 9, and the like of the optical reading device 1. Thus, the computer 100 may be prepared separately from the optical reading device 1 such that the computer 100 makes various settings of the optical reading device 1 and transfers setting information to the optical reading device 1.

In addition, since the computer 100 includes the communication unit 44, the computer 100 and the optical reading device 1 may be connected to enable bidirectional communication such that a part of processing of the optical reading device 1 described above is performed by the computer 100. In this case, a part of the computer 100 serves as some components of the optical reading device 1.

The control unit 40 is a unit that controls each unit provided in the computer 100 based on a program stored in the storage device 41. The storage device 41 is constituted by various memories, a hard disk, a solid state drive (SSD), and the like. The display unit 42 is constituted by, for example, a liquid crystal display and the like. The input unit 43 is constituted by a keyboard, a mouse, a touch sensor, and the like. The communication unit 44 is a portion that communicates with the optical reading device 1. The communication unit 44 may have an I/O unit connected to the optical reading device 1, a serial communication unit such as RS232C, and a network communication unit such as a wireless LAN and a wired LAN.

The control unit 40 generates a user interface image to set an imaging condition of the imaging unit 5 and an image processing condition of the processing unit 23 in the optical reading device 1 and a user interface image or the like to display a decoding result, image data, or the like output from the optical reading device 1, and causes the display unit 42 to display the user interface image. The display unit 42 may constitute a part of the optical reading device 1. The storage device 41 is a portion that stores the decoding result, which is a result of a decoding process executed by the processing unit 23, the image captured by the imaging unit 5, various types of setting information, and the like.

In addition, the optical reading device 1 receives a reading start trigger signal that defines reading start timings of the first code CD1 and the second code CD2 from the PLC 101 via the signal line 101 a during its operation time. Further, the optical reading device 1 performs imaging and a decoding process of the workpiece W based on the reading start trigger signal. Thereafter, the decoding result obtained by the decoding process is transmitted to the PLC 101 via the signal line 101 a. In this manner, during the operation time of the optical reading device 1, the input of the reading start trigger signal and the output of the decoding result are repeatedly performed via the signal line 101 a between the optical reading device 1 and the external control device such as the PLC 101. Note that the input of the reading start trigger signal and the output of the decoding result may be performed via the signal line 101 a between the optical reading device 1 and the PLC 101 as described above, or may be performed via another signal line (not illustrated). For example, a sensor configured to detect arrival of the workpiece W at a predetermined position and the optical reading device 1 are directly connected to each other to input the reading start trigger signal from the sensor to the optical reading device 1. In addition, the decoding result, the image, and various types of setting information can be output to a device other than the PLC 101, for example, the computer 100.

[Overall Configuration of Optical Reading Device 1]

As illustrated in FIGS. 5 to 7, the optical reading device 1 includes a housing 2 and a front cover 3. As illustrated in FIG. 5, an illumination unit 4, an imaging unit 5, and an aimer 6 are provided on a front surface of the housing 2. Configurations of the illumination unit 4 and the imaging unit 5 will be described later. The aimer 6 is configured using, for example, a light emitting body such as a light emitting diode. The aimer 6 is configured to emit light toward the front of the optical reading device 1 to indicate an imaging range of the imaging unit 5 and a guideline for an optical axis of the illumination unit 4. A user can also refer to the light emitted from the aimer 6 to install the optical reading device 1.

In addition, one end surface of the housing 2 is provided with the display unit 7, a select button 8, an enter button 9, and an indicator 10 as illustrated in FIG. 6. A configuration of the display unit 7 will be described later. The select button 8 and the enter button 9 are buttons used for setting or the like of the optical reading device 1, and are connected to a control section 20. The control section 20 can detect operating states of the select button 8 and the enter button 9. The select button 8 is a button that is operated when selecting one from among a plurality of options displayed on the display unit 7. The enter button 9 is a button that is operated when confirming a result selected by the select button 8. The indicator 10 is connected to the control section 20 and can be configured using a light emitting body such as a light emitting diode. The operating state of the optical reading device 1 can be notified to the outside by a lighting state of the indicator 10.

In addition, a power connector 11, a network connector 12, a serial connector 13, and a USB connector 14 are provided on the other end surface of the housing 2 as illustrated in FIG. 7. In addition, a heat sink 15 serving as a rear case is provided on a back surface of the housing 2. A power wiring configured to supply power to the optical reading device 1 is connected to the power connector 11. The serial connector 13 corresponds to the signal line 101 a connected to the computer 100 and the PLC 101, and the network connector 12 is an Ethernet connector. Note that the Ethernet standard is an example, and signal lines of standards other than the Ethernet standard can be also used.

Further, the control section 20, a storage device 50, an output unit 60, and the like illustrated in FIG. 3 are provided inside the housing 2. These will be described later.

Although the front surface and the back surface of the optical reading device 1 are defined as described above in the description of the present embodiment, this is given merely to achieve the convenience of the description, and does not limit the orientation during the operation time of the optical reading device 1. That is, as illustrated in FIG. 1, the optical reading device 1 can be installed and used with the front surface directed substantially downward, the optical reading device 1 can be installed and used with the front surface directed upward, the optical reading device 1 can be installed and used with the front surface directed downward and inclined, or the optical reading device 1 can be installed and used with the front surface extending along a vertical plane.

[Configuration of Illumination Unit 4]

As indicated by the broken line in FIG. 5, the illumination unit 4 is a member configured to emit light toward an area through which the workpiece W conveyed by the conveying belt conveyor B passes. The light emitted from the illumination unit 4 illuminates at least a predetermined range in the conveying direction of the conveying belt conveyor B. This predetermined range is a range wider than a dimension in the same direction of the largest workpiece W assumed to be conveyed during the operation time. The illumination unit 4 illuminates the first code CD1 and the second code CD2 attached to the workpiece W conveyed by the conveying belt conveyor B.

The illumination unit 4 includes a light emitting body 4 a made of a light emitting diode or the like, for example, and the light emitting body 4 a may be one, or a plurality of light emitting bodies 4 a may be provided. In this example, the plurality of light emitting bodies 4 a are provided, and the imaging unit 5 faces the outside between the light emitting bodies 4 a. In addition, the light of the aimer 6 is emitted from a portion between the light emitting bodies 4 a. The illumination unit 4 is electrically connected to an imaging control unit 22 of the control section 20 and can be controlled by the control section 20 to be turned on and off at arbitrary timings.

In this example, the illumination unit 4 and the imaging unit 5 are mounted on the single housing 2 to be integrated, but the illumination unit 4 and the imaging unit 5 may be configured as separate bodies. In this case, the illumination unit 4 and the imaging unit 5 can be connected in a wired or wireless manner. In addition, the control section 20, which will be described later, may be built in the illumination unit 4 or the imaging unit 5. The illumination unit 4 mounted on the housing 2 is referred to as an internal lighting, and the illumination unit 4 configured as a separate body from the housing 2 is referred to as an external lighting. It is also possible to illuminate the workpiece W using both the internal lighting and the external lighting.

[Configuration of Imaging Unit 5]

FIG. 3 is a block diagram illustrating the configuration of the optical reading device 1. The imaging unit 5 is a member configured to receive light emitted from the illumination unit 4 and reflected from an area through which the workpiece W passes, and generate a read image obtained by capturing the image of the area through which the workpiece W passes. As the imaging unit 5, an area camera in which pixels are arrayed vertically and horizontally (X direction and Y direction) can be used. As a result, it is possible to support reading of a two-dimensional code and to capture the images of one workpiece W being conveyed a plurality of times.

As illustrated in FIG. 3, the imaging unit 5 includes: an imaging element 5 a that can capture the image of at least a portion of the workpiece W to which the first code CD1 and the second code CD2 are attached; an optical system 5 b having lenses and the like; and an autofocus mechanism (AF mechanism) 5 c. Light reflected from at least the portion of the workpiece W to which the first code CD1 and the second code CD2 are attached is incident on the optical system 5 b. The imaging element 5 a is an image sensor including a light receiving element such as a charge-coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) that converts an image having the first code CD1 and the second code CD2 obtained through the optical system 5 b into an electrical signal.

The AF mechanism 5 c is a mechanism that performs focusing by changing a position and a refractive index of a focusing lens among the lenses constituting the optical system 5 b. The AF mechanism 5 c is connected to the control section 20 and is controlled by an AF control unit 21 of the control section 20.

The imaging element 5 a is connected to the imaging control unit 22 of the control section 20. The imaging element 5 a is controlled by the imaging control unit 22 and is configured to be capable of capturing an image of an area through which the workpiece W passes at predetermined fixed time intervals and capturing an image of an area through which the workpiece W passes at arbitrary timings with changed time intervals. The imaging unit 5 is configured to be capable of executing so-called infinite burst imaging in which successive generation of read images is continued. As a result, it is possible to capture the codes CD1 and CD2 of the workpiece W moving at high speed into the read image without missing the codes CD1 and CD2, and it is possible to generate a plurality of read images by capturing the images of one workpiece W being conveyed a plurality of times. Note that the imaging control unit 22 may be built in the imaging unit 5.

The intensity of light received by a light receiving surface of the imaging element 5 a is converted into an electrical signal by the imaging element 5 a, and the electrical signal converted by the imaging element 5 a is transferred to the processing unit 23 of the control section 20 as image data constituting a read image. Specifically, the imaging element 5 a generates a read image, and then, transfers the read image to the processing unit 23 line by line. One line corresponds to, for example, one column (or one row) in the vertical direction or horizontal direction of the imaging element 5 a. To transfer the read image line by line is to perform transfer of brightness values of a plurality of pixels constituting a vertical column of the imaging element 5 a or brightness values of a plurality of pixels constituting a horizontal column of the imaging element 5 a to the processing unit 23 and then transfer of brightness values of a plurality of pixels constituting a column next to the transferred column to the processing unit 23 sequentially in a direction in which columns are arrayed. Note that, after generating the read image, the imaging element 5 a may transfer the entire read image to the processing unit 23 at once without performing the transfer to the processing unit 23 line by line. This can be controlled by, for example, the imaging control unit 22.

[Configuration of Display Unit 7]

The display unit 7 is configured using, for example, an organic EL display, a liquid crystal display, or the like. The display unit 7 is connected to the control section 20 as illustrated in FIG. 3. On the display unit 7, for example, the codes CD1 and CD2 captured by the imaging unit 5, and a character string, a read success rate, a matching level (reading margin), and the like, which are decoding results of the codes CD1 and CD2, can be displayed. The read success rate is an average read success rate when read processing is executed a plurality of times. The matching level is a reading margin that indicates the ease of reading the codes CD1 and CD2 that have been successfully decoded. This can be obtained from the number of error corrections having occurred during decoding, and can be expressed numerically, for example. The matching level (reading margin) increases as the error corrections decrease, and the matching level (reading margin) decreases as the error corrections increase.

[Configuration of Storage Device 50]

The storage device 50 is constituted by various memories, a hard disk, an SSD, and the like. The storage device 35 is provided with a decoding result storage unit 51, an image data storage unit 52, and a parameter set storage unit 53. The decoding result storage unit 51 is a portion that stores a decoding result which is a result obtained by executing a decoding process using the processing unit 23. The image data storage unit 52 is a portion that stores an image captured by the imaging unit 5. The parameter set storage unit 53 is a portion that stores setting information set by a setting device such as the computer 100, setting information set by the select button 8 and the enter button 9, setting information obtained as a result of executing tuning by the tuning execution unit 24, and the like. The parameter set storage unit 53 can store a plurality of parameter sets including a plurality of parameters constituting imaging conditions (gain, the amount of light of the illumination unit 4, exposure time, and the like) of the imaging unit 5 and image processing conditions (a type of image processing filter and the like) in the processing unit 23.

FIG. 8 is a view illustrating a display example of the plurality of parameter sets. The control unit 40 of the computer 100 can generate a user interface image 300 as illustrated in FIG. 8 and causes the display unit 42 of the computer 100 to display the user interface image 300. A plurality of tabs 301, 302, and 303 are provided on the upper part of the user interface image 300, and any one of the plurality of tabs 301, 302, and 303 can be selected.

In this example, a case where the tab 302 of a bank has been selected is illustrated. One parameter set is referred to as the “bank”. In the example illustrated in FIG. 8, only Bank 1 and Bank 2 are displayed, but the number of banks can be set arbitrarily.

As a common setting item for each bank, provided are “decoding timeout value” that indicates the timeout time of a decoding process, “black and white inversion” that inverts black and white of a read image, “internal lighting” that switches on and off of the internal lighting constituted by the illumination unit 4 mounted on the housing 2, “external lighting” that switches on and off of the external lighting constituted by the illumination unit 4 configured as a separate body from the housing 2, and “detailed code settings” for switching a code type. In addition, as reading setting items, “exposure time” that indicates the exposure time by the imaging unit 5, “gain” that indicates the gain of the imaging unit 5, “contrast adjustment scheme” that indicates a method for adjusting the contrast of a read image, a “first image filter” and a “second image filter” that select types and order of image filters to be applied, and the like are provided in each bank.

In the optical reading device 1, the user can select a bank to be used during the operation time of the optical reading device 1 from among a plurality of banks stored in the parameter set storage unit 53. That is, the user can operate the input unit 43 of the computer 100 while viewing the user interface image 300 illustrated in FIG. 8 and select an arbitrary bank on the user interface image 300. The input unit 43 is a receiving unit that receives the user's selection on a first bank (Bank 1) and a second bank (Bank 2) from among the plurality of banks stored in the storage device 50. Note that Bank 1 is a parameter set for reading a one-dimensional code, and Bank 2 is a parameter set for reading a two-dimensional code. Note that the bank can be selected, for example, by operating a button (not illustrated) displayed on the user interface image 300.

[Configuration of Output Unit 60]

The optical reading device 1 has the output unit 60. The output unit 60 is a portion that outputs a decoding result obtained by a decoding process of the processing unit 23 to be described later. Specifically, when the decoding process is completed, the processing unit 23 transmits the decoding result to the output unit 60. The output unit 60 can be constituted by a communication unit that transmits data related to the decoding result received from the processing unit 23 to, for example, the computer 100 and the PLC 101. The output unit 60 may have an I/O unit connected to the computer 100 and the PLC 101, a serial communication unit such as RS232C, and a network communication unit such as a wireless LAN or a wired LAN.

[Configuration of Control Section 20]

The control section 20 illustrated in FIG. 3 is a section configured to control each part of the optical reading device 1, and can be configured using a CPU, an MPU, a system LSI, a DSP, dedicated hardware, or the like. The control section 20 is equipped with various functions as will be described later, and these may be implemented by a logic circuit or may be implemented by executing software.

The control section 20 includes the AF control unit 21, the imaging control unit 22, the processing unit 23, the tuning execution unit 24, and a UI management unit 25. The AF control unit 21 is a portion that performs focusing of the optical system 5 b by conventionally known contrast AF and phase difference AF. The AF control unit 21 may be included in the imaging unit 5.

[Configuration of Imaging Control Unit 22]

The imaging control unit 22 is a portion that controls not only the imaging unit 5 but also the illumination unit 4. That is, the imaging control unit 22 is configured as a unit that adjusts the gain of the imaging element 5 a, controls the amount of light of the illumination unit 4, and controls the exposure time (shutter speed) of the imaging element 5 a. The gain, the amount of light of the illumination unit 4, the exposure time, and the like are included in the imaging conditions of the imaging unit 5.

[Configuration of Processing Unit 23]

As illustrated in FIG. 4, the processing unit 23 includes a pre-processing circuit 30, a memory 31, and a processor 40. The image data for each line transferred from the imaging element 5 a is input to the pre-processing circuit 30. The pre-processing circuit 30 is a pre-processor arranged at the front stage of the processor 40 and can be configured using, for example, a programmable logic device (PLD), and examples thereof can include an FPGA and an ASIC.

The pre-processing circuit 30 executes pre-processing on image data each time a predetermined number of lines of image data is acquired from the imaging element 5. The predetermined number of lines of image data is data forming a partial area of one read image. Accordingly, the pre-processing is executed for each of different areas of one read image.

The predetermined number of lines is an arbitrary number of lines of one or more, and is the number of lines required to detect likelihood of a code. Examples of the pre-processing can include a gradation conversion process, various image filtering processes, and the like. The pre-processing may include only one or a plurality of these processes. The gradation conversion process may be a process of lowering the gradation of image data captured by the imaging element 5 a, and specifically, is a process of making the gradation to 8 bits when the gradation of the image data captured by the imaging element 5 a is 12 bits. The pre-processing may include a reduced image generation process.

The pre-processing circuit 30 executes a code search data generation process after executing the pre-processing. The code search data generation process includes a process of calculating a characteristic amount indicating likelihood of a code for each area in pre-processed image data based on a brightness value of each pixel in the pre-processed image data. Specific examples of the characteristic amount can include a combination of edge data, but are not limited thereto. After calculating the characteristic amount, the pre-processing circuit 30 generates a characteristic amount image to which a brightness value corresponding to the calculated characteristic amount has been assigned.

The code search data generation process executed by the pre-processing circuit 30 will be described with reference to FIG. 9. FIG. 9 illustrates the code search data generation process when there is only one type of code attached to the workpiece W, and this code may be a one-dimensional code or a two-dimensional code. In Step SA1 after start, an image after having been subjected to the pre-processing in the pre-processing circuit 30, that is, the pre-processed image is read. Thereafter, the process proceeds to Step SA2, and the pre-processing circuit 30 executes edge detection processing on the pre-processed image to generate edge data. The edge detection processing can be executed using, for example, a Sobel filter or the like. For example, in the case of the one-dimensional code, a composite image may be generated by adding or the like for the X-direction Sobel and the Y-direction Sobel if a rotation angle of a bar code is 0° and 90°, respectively, and for the X-direction Sobel and Y-direction Sobel images if there is no premise for the rotation angle of the bar code.

In Step SA2, as an image after having been subjected to the edge detection processing, for example, an edge strength image, an edge angle image, and the like can be generated, and an image obtained by executing common convolution processing and arithmetic processing may be further generated. In addition, not only first-order differential processing but also second-order differential processing can be used as the edge detection processing.

In Step SA3, the edge data generated in Step SA2 is acquired. Thereafter, the process proceeds to Step SA4, and an edge data integration process of integrating edge data of a certain pixel and its vicinity is executed. For example, there is a high possibility that a code exists in an area where pixels having large brightness values gather in the edge data, and thus, the area can be presumed as a code candidate area. It is possible to express the area where the pixels having large brightness values gather by integrating the edge data of the certain pixel and its vicinity constituting the edge data. In this example, it is possible to execute a product-sum calculation process or a pixel integration process configured to generate data for measuring the degree of gathering of edge data within a certain area. For example, a smoothing process that has an effect of adding pixel values within a specific window size can be used. In addition, a reduction process may be used. When the reduction process is used, the amount of data decreases, so that there is an advantage that the amount of scanning can be small.

Through Steps SA2 to SA4, the pre-processing circuit 30 can calculate the characteristic amount indicating the likelihood of the code for each area in the pre-processed image data, and generate the characteristic amount image to which the brightness value corresponding to the calculated characteristic amount is assigned. In the characteristic amount image, an area with a large characteristic amount can be displayed brighter or darker than an area with a small characteristic amount, so that a so-called heat map image can be obtained and generated based on the edge data. That is, the edge detection processing is executed on the image data to generate the edge data, and then, the edge data integration process of integrating the edge data of the certain pixel and its vicinity is executed. Then, the process proceeds to Step SA5, and the heat map image which is the characteristic amount image can be generated.

FIG. 10A is a view illustrating an example of a read image 200 generated by capturing an image of the workpiece W illustrated in FIG. 2 with the imaging unit 5. The read image 200 includes the first code CD1 which is a one-dimensional code and the second code CD2 which is a two-dimensional code.

FIG. 10B is a view illustrating an example of a one-dimensional code heat map image 201 to which brightness values are assigned according to the characteristic amount (first characteristic amount) indicating the likelihood of the one-dimensional code. In the one-dimensional code heat map image 201, a brightness value of a candidate area for the one-dimensional code is high, and brightness values of the other areas (areas where the one-dimensional code does not exist) are low. In FIG. 10B, the white portion illustrates the candidate area for the one-dimensional code, and the black portion illustrates the other area. Although the two-dimensional code exists in an area surrounded by the white dashed line in FIG. 10B, the brightness value of the area having the code other than the one-dimensional code is low since the heat map image 201 is generated based on the characteristic amount of the one-dimensional code in the above example. The one-dimensional code heat map image 201 is used by the processor 40 as one-dimensional code search data.

Although the heat map image 201 is generated based on the characteristic amount of the one-dimensional code in the above example, the pre-processing circuit 30 may also calculate a characteristic amount of the two-dimensional code, and generate a two-dimensional code heat map image 202 (illustrated in FIG. 10C) based on the characteristic amount of the likelihood of the two-dimensional code without being limited thereto.

FIG. 10C is a view illustrating the two-dimensional heat map image 202 to which brightness values are assigned according to the characteristic amount (second characteristic amount) indicating the likelihood of the two-dimensional code. In the two-dimensional code heat map image 202, a brightness value of a candidate area for the two-dimensional code is high, and brightness values of the other areas (areas where the two-dimensional code does not exist) are low. In FIG. 10C, the white portion illustrates the candidate area for the two-dimensional code, and the black portion illustrates the other area. Although the one-dimensional code exists in an area surrounded by the white dashed line in FIG. 10C, the brightness value of the area having the code other than the two-dimensional code is low since the heat map image 202 is generated based on the characteristic amount of the two-dimensional code in this example. The two-dimensional code heat map image 202 is used by the processor 40 as two-dimensional code search data.

Note that the white dashed lines in FIGS. 10B and 10C are illustrated only for the description and are not displayed in the actual heat map images 201 and 202. If there are a plurality of code candidate areas, the plurality of areas are illustrated in a heat map image. In addition, the heat map images 201 and 202 may be or are not necessarily presented to the user.

FIG. 11 is a flowchart illustrating a procedure for generating the one-dimensional code heat map image 201 and the two-dimensional code heat map image 202 when both the one-dimensional code and the two-dimensional code are attached to one workpiece WK. Steps SB1 to SB3 are the same as Steps SA1 to SA3 in the flowchart illustrated in FIG. 9. In Step SB4, an edge data integration process for the one-dimensional code is executed. In the edge data integration process for the one-dimensional code, edges with aligned edge directions are integrated by utilizing shape characteristics of the one-dimensional code. For example, edge angle images are generated, those with close edge angles are added, and those with far edge angles are subtracted. In addition, a process of adding image data having close edge directions and subtracting image data having different edge directions may be executed within a certain range of the edge data. Thereafter, the process proceeds to Step SB6, and the one-dimensional code heat map image 201 (see FIG. 10B) is generated as described in Step SA5 of the flowchart of FIG. 9.

In addition, in Step SB5, an edge data integration process for the two-dimensional code is executed. In the edge data integration process for the two-dimensional code, edges with irregular edge directions are integrated by utilizing shape characteristics of the two-dimensional code. In addition, a process of adding image data having different edge directions may be executed within a certain range of the edge data. Thereafter, the process proceeds to Step SB7, and the two-dimensional code heat map image 202 (see FIG. 10C) is generated as described in Step SA5 of the flowchart of FIG. 9. In the flowchart of FIG. 11, steps SB4 and SB6 and steps SB5 and SB7 may be performed in parallel, or one of them may be performed first.

As illustrated in FIG. 4, the processor 40 is a multi-core processor having a plurality of physical arithmetic processing devices (cores), acquires the characteristic amount calculated by the pre-processing circuit 30, determines the code candidate area in the read image based on the acquired characteristic amount, and executes a decoding process of the determined area to generate a decoding result. The output unit 60 outputs the generated decoding result.

As the acquisition form of the characteristic amount calculated by the pre-processing circuit 30, the characteristic amount itself may be used, or the form of acquiring the characteristic amount images (heat map images 201 and 202 illustrated in FIGS. 10B and 10C) generated by the pre-processing circuit 30 may be used. When acquiring the characteristic amount image, the processor 40 can determine the code candidate area based on the acquired characteristic amount image.

That is, the processor 40 determines the candidate area for the first code CD1 based on the one-dimensional code heat map image 201, and also determines the candidate area for the second code CD2 based on the two-dimensional code heat map image 202. At this time, the processor 40 sets areas where the brightness values of the one-dimensional code heat map image 201 and the two-dimensional code heat map image 202 are equal to or higher than a predetermined value as the candidate area for the first code CD1 and the candidate area for the second code CD2, respectively, and thus, it is possible to accurately identify an area with a large characteristic amount. In this case, the decoding process of each determined area is executed to generate a decoding result.

As illustrated in FIG. 4, the processor 40 and the memory 31 are connected so as enable transmission and reception of data in this example. The memory 31 is configured using a high-speed memory such as a DDR RAM. The image data transferred from the imaging element 5 a to the pre-processing circuit 30 is stored in the memory 31 via the processor 40. At this time, the processor 40 determines any address of the memory 31 at which the image data is to be stored, and stores the image data at the determined address at high speed. Since the image data is stored every time the imaging element 5 a captures an image, a plurality of pieces of image data are stored in the memory 31. The processor 40 appropriately reads the image data from the memory 31, executes a decoding process, and stores a result thereof in the memory 31.

[Details of Decoding Process]

The processor 40 has nine cores of cores CR0 to CR8. The core CR0 is a core that instructs the other cores CR1 to CR8 to execute a decoding process of a read image generated by the imaging unit 5, and corresponds to the first core. The cores CR1 to CR8 are cores that acquire read images instructed by the core CR0 and execute a decoding process on the acquired read images, and correspond to the second cores. The first core that instructs the decoding process is the single core CR0, but the second cores that execute the decoding process are the eight cores CR1 to CR8. It suffices that the number of the second cores that execute the decoding process is two or more, and the number is not particularly limited. When executing the decoding process, the instructed read images may be transferred from the memory 31 to the cores CR1 to CR8 and then the decoding process may be executed on the transferred read images, or the decoding process may be executed after the cores CR1 to CR8 read the instructed read images from the memory 31. Note that the core CR0 may execute the decoding process.

The core CR0 instructs the cores CR1 to CR8, presumed to be capable of immediately executing the decoding process or executing the decoding process next to a decoding process being currently executed, to execute the decoding process. The decoding process is usually instructed to the cores CR1 to CR8 at different timings, and a plurality of decoding processes may be executed in parallel since each of the cores CR1 to CR8 executes the decoding process. That is, the cores CR1 to CR8 are configured to be capable of simultaneously executing the decoding process on read images instructed by the core CR0 at different timings.

Details of the decoding process of this example will be described hereinafter. FIG. 12 is a timing chart illustrating an example of a case where the decoding process is executed on a plurality of read images.

The imaging unit 5 captures images of the workpiece W and sequentially generates read images. In FIG. 12, C1 to C10 indicate the first to tenth read image generation processes, respectively. As illustrated in this drawing, the imaging unit 5 performs burst imaging so that the first read image generation process C1 to the tenth read image generation process C10 are successively executed. If an imaging interval is, for example, 30 fps, the time for one read image generation process is about 33 ms.

Meanwhile, D1 to D10 indicate first to tenth decoding processes, respectively, in FIG. 12. The time required for each decoding process is, for example, about 50 ms to 100 ms even in the case of high-speed processing, which is significantly longer than the time for the read image generation process (about 33 ms) by the imaging unit 5.

When the first read image generation process C1 is completed, the core CR0 that instructs the decoding process instructs the core CR1 to execute a decoding process of a read image generated by the first read image generation process C1. In addition, the core CR0 instructs the core CR2 to execute a decoding process of a read image generated by the second read image generation process C2 when the second read image generation process C2 is completed, and instructs the core CR3 to execute a decoding process of a read image generated by the third read image generation process C3 when the third read image generation process C3 is completed. In other words, if the core CR1 has been instructed to execute the decoding process and the cores CR2 and 3 have not been instructed to execute the decoding process, it is presumed that the cores CR2 and 3 are cores capable of immediately executing a decoding process, and in this case, the core CR0 instructs the cores CR2 and 3 to execute the decoding process. The same applies to the cores CR4 to CR8.

In addition, when the ninth read image generation process C9 is completed, the core CR0 instructs the core CR1 to execute a decoding process of a read image generated by the ninth read image generation process C9. Since the decoding process has been instructed to the cores CR2 to CR8, a certain amount of time has elapsed since the previous instruction, and it is presumed that the core CR1 is a core that can execute a decoding process immediately. In this case, the decoding process of the read image generated by the ninth read image generation process C9 can be executed by instructing the core CR1 to execute the decoding process. Similarly, the core CR2 is instructed to execute a decoding process of a read image generated by the tenth read image generation process C10. As the cores CR1 to CR8 are instructed to execute the decoding processes in order in this manner, at least two of the cores CR1 to CR8 execute the decoding processes at the same time.

Here, the time until the core CR0 stores the read image in the memory 31 after completion of the read image generation process and each of the cores CR1 to CR8 having been instructed to execute reading starts to read the read image is referred to as transfer time.

In addition, the cores CR1 to CR8 can execute the decoding process immediately after the transfer time has elapsed since the generation of the read image, and thus, there is no relation with the previous and subsequent processes, and there is no need to adjust the timing.

Further, the imaging unit 5 can continue infinite burst imaging, and thus, it is possible to capture the code even during high-speed conveyance and to leave a successive image like a moving image.

T1 in FIG. 12 represents the time between the completion of the previous decoding process to the instruction of the next decoding process. Time T1 can be secured much longer than time T2 required for the decoding process. In other words, a long upper limit time of the decoding process can be secured, and an obfuscated code can be decoded. The upper limit time of the decoding process is a timeout time of the decoding process. When the decoding process takes a long time during the operation of the optical reading device 1, the timeout time is set to abort the decoding process if reaching the preset upper limit time.

FIG. 13 is a conceptual diagram in a case where a plurality of read images (first to third read images) are processed in parallel by a plurality of threads (Threads 1 and 2) in the plurality of cores CR1 to CR3. As illustrated in this example, if the first read image includes a one-dimensional code and a two-dimensional code, a decoding process of the one-dimensional code is executed as Thread 1, and a decoding process of the two-dimensional code is executed as Thread 2 in the core CR1 that executes the decoding process on the first read image. Similarly, in the core CR2, a decoding process of a one-dimensional code included in the second read image is executed as Thread 1, and a decoding process of a two-dimensional code included in the second read image is executed as Thread 2. In addition, in the core CR3, a decoding process of a one-dimensional code included in the third read image is executed as Thread 1, and a decoding process of a two-dimensional code included in the third read image is executed as Thread 2. Even when the plurality of one-dimensional codes are attached or when the plurality of two-dimensional codes are attached, it is possible to instruct different cores to execute the decoding processes.

The number of threads in each of the cores CR1 to CR3 is not limited to two, and may be one or three or more. When the workpiece W has only one-dimensional code or only two-dimensional code, each of the cores CR1 to CR3 has one thread.

In addition, as illustrated in FIG. 14, the core CR0 can also give an instruction such that the decoding process of the one-dimensional code included in the first read image is executed by Thread 1 of the core CR1, and the decoding process of the two-dimensional code included in the first read image is executed by Thread 1 of the core CR2. Regarding the second read image, the core CR0 gives an instruction such that the decoding process of the one-dimensional code is executed by the core CR3 and the decoding process of the two-dimensional code is executed by the core CR4 in the same manner.

FIG. 15 is a flowchart in a case where instructing a core that has completed the decoding process is instructed to execute the next decoding process, and the core CR0 determines the order of allocating the decoding processes to the respective cores CR1 to CR8 by first-in first-out (FIFO). This flowchart starts at the timing when the optical reading device 1 receives the reading start trigger signal, and ends at the timing when an operation stop operation is performed.

After the start, the imaging unit 5 captures images of the workpiece W and sequentially generates a plurality of read images in Step SC1. In Step SC2, the core CR0 determines whether the cores CR1 to CR8 are free. The term “free” is used when the decoding process is not performed, and the decoding process can be executed immediately. If it is determined as YES in Step SC2 and any of the cores CR1 to CR8 is free, the process proceeds to Step SC4. In Step SC4, the core CR0 instructs the free core to execute a decoding process, and thus, the decoding process is executed immediately by the free core, and then, the process returns to Step SC1. On the other hand, if it is determined as NO in Step SC2 and there is no free core among the cores CR1 to CR8, the process proceeds to Step SC3 and waits for generation of a free core for a predetermined time, then, proceeds to Step SC2, and proceeds to Step SC4 if there is a free core.

A specific example of the case of determining the allocation of decoding processes by FIFO will be described with reference to FIG. 16. FIG. 16 describes a case where the cores CR1 to CR3 are provided. A number illustrated in the field of a queue state is a number of a free core, and the core CR1, the core CR2, and the core CR3 correspond to “1”, “2”, and “3”, respectively.

At the beginning, the numbers 1 to 3 are loaded in the queue state since all the cores CR1 to CR3 are free. Thereafter, when the core CR1 is instructed to execute the decoding process of the read image of the first read image generation process C1, the number 1 disappears and the numbers 2 and 3 are loaded in the queue state. Therefore, the core CR0 can instruct the core CR2 to execute the decoding process of the read image of the second read image generation process C2. Similarly, the core CR0 can instruct the core CR3 to execute the decoding process of the read image of the third read image generation process C3.

When the fourth read image generation process C4 is completed, only the number 1 is loaded in the queue state, and thus, the core CR0 instructs the core CR1 to execute the decoding process of the read image of the fifth read image generation process C5. In this manner, the core CR0 determines the availability of the cores CR1 to CR3 and instructs the free core to execute the decoding process. Thus, it is easier to realize high-speed and fixed-interval reading as compared with the case where the decoding process is simply assigned to the cores CR1 to CR3 in order.

[Configuration of Tuning Execution Unit 24]

The tuning execution unit 24 illustrated in FIG. 3 is a unit that changes imaging conditions such as gain, the amount of light of the illumination unit 4, the exposure time, and image processing conditions in the processing unit 23. The image processing conditions in the processing unit 23 include a coefficient of an image processing filter (the strength of the filter) and switching of image processing filters, a combination of different types of image processing filters, and the like when there are a plurality of image processing filters. Appropriate imaging conditions and image processing conditions differ depending on the influence of external light on the workpiece W during conveyance, a color and a material of a surface to which the codes CD1 and CD2 are attached, and the like. Accordingly, the tuning execution unit 24 searches for more appropriate imaging conditions and image processing conditions, and sets the processing by the AF control unit 21, the imaging control unit 22, and the processing unit 23. As the image processing filters, various conventionally known filters can be used.

Before operating the optical reading device 1, the setting of the optical reading device 1 is made as an operation preparation stage. At the time of setting the optical reading device 1, various settings are made by transmitting various commands for setting from the computer 100 connected to the optical reading device 1 via the signal line 101 a. During this setting, tuning is performed by the tuning execution unit 24. A specific example of the tuning will be described with reference to FIG. 17. After the start of tuning, the codes CD1 and CD2 attached to the workpiece W are imaged by the imaging unit 5 to generate a read image in Step SD1.

Further, the process proceeds to Step SD2, and each of the codes CD1 and CD2 included in the generated read image is searched and decoded by the processing unit 23, and the processing unit 23 analyzes the reading margin, which indicates the ease of reading the codes CD1 and CD2 that have been successfully decoded. Thereafter, the process proceeds to Step SD3, and the tuning execution unit 24 changes the imaging conditions and set the suitability of an image processing filter and the strength of the image processing filter to be applied so as to increase the reading margin analyzed by the processing unit 23.

In Step SD4, the time required for the decoding process is measured. In Step SD5, it is determined whether or not the decoding processing time is within a fastest imaging interval decoding time. The fastest imaging interval decoding time is the time (reference time) obtained by multiplying the time, obtained by adding the generation time and the transfer time of the read image obtained by the imaging unit 5, by the number of the cores CR1 to CR8. For example, when the generation time of the read image by the imaging unit 5 is A, the time (transfer time) required until the core CR0 stores the generated read image in the memory 31 and the cores CR1 to CR8 start reading is B, and the number of the cores CR1 to CR8 is C, the time obtained by the following formula is the fastest imaging interval decoding time.

Fastest imaging interval decoding time=(A+B)×C

If it is determined as YES in Step SD5 and the decoding processing time measured in Step SD4 is within the fastest imaging interval decoding time, the process proceeds to Step SD6, and the decoding processing time measured in Step SD4 is set as an upper limit time of the decoding process. That is, the tuning execution unit 24 generates the read image including the code using the imaging unit 5 and executes the decoding process on the generated read image using the processing unit 23 to measure the time required for the decoding process at the time of setting the optical reading device 1, and automatically sets the upper limit time of the decoding process based on the measured result. Note that the upper limit time of the decoding process can be automatically set to be shorter than the fastest imaging interval decoding time.

On the other hand, if it is determined as NO in Step SD5 and the decoding processing time measured in Step SD4 exceeds the fastest imaging interval decoding time, the measured result is set as the upper limit time of the decoding process, and the process proceeds to Step SD7 to set a fixed interval imaging mode. The fixed interval imaging mode will be described later.

After passing through Steps SD6 and SD7, the process proceeds to Step SD8 and set conditions are stored. The set conditions can be stored in the form of a bank as illustrated in FIG. 8.

FIG. 18 is a timing chart of the fixed interval imaging mode. Although the core CR0 is omitted in this drawing, the decoding process is instructed by the core CR0. In addition, the example of providing the cores CR1 to CR3 is illustrated, but the number of cores does not matter.

The fixed interval imaging mode is a mode selected when the execution of burst imaging is not suitable as a result of the tuning described above. In the fixed interval imaging mode, the imaging unit 5 captures images intermittently as illustrated by C1 to C5 in FIG. 18. Thus, for example, the second read image generation process C2 is not started immediately even if the first read image generation process C1 is completed, and the second read image generation process C2 is started with a predetermined time interval. When the first read image generation process C1 is completed, the core CR0 instructs the core CR1 to execute the decoding process of the read image generated by the first read image generation process C1. The decoding process is also executed sequentially on the second and subsequent read images.

Since this fixed interval imaging mode is the mode applied when it is necessary to lengthen the time of the decoding process for one read image, an imaging interval becomes wider, but this interval is fixed at a predetermined time interval, and thus, the imaging interval is not changed so that the workpiece W can be prevented from passing during the imaging.

On the other hand, FIG. 19 is a timing chart when imaging is not performed at fixed intervals. This example is also the example of providing the cores CR1 to CR3. The read images generated by the first to third read image generation processes C1 to C3 are subjected to the decoding processes by the cores CR1 to CR3, respectively. Meanwhile, even if the fourth read image generation process C4 is completed, there may be no core capable of executing the decoding process on the read image generated by that process since the decoding processing time in the cores CR1 to CR3 is long. Accordingly, the read image generated by the fourth read image generation process C4 is subjected to the decoding process by the core CR1 after waiting for the completion of the decoding process of the core CR1. In this case, there is a time interval until the fifth read image generation process C5 is started since the completion of the fourth read image generation process C4.

That is, as illustrated in the flowchart of FIG. 20, the optical reading device 1 starts at the timing when the reading start trigger signal is received, generates the read image in Step SE1 after the start, determines whether there is a free core in Step SE2, and then, proceeds to Step SE3 if there is a free core, and instructs the free core to execute the decoding process, or proceeds to Step SE4 if there is no free core, waits for the generation of a free core, and then, instructs the free core to execute the decoding process.

If there is no free core, the image data can be temporarily stored in the buffer. That is, as illustrated in the flowchart of FIG. 21, the optical reading device 1 starts at the timing when the reading start trigger signal is received, generates the read image in Step SF1 after the start, determines whether there is a free core in Step SF2, and then, proceeds to Step SF3 if there is a free core, and instructs the free core to execute the decoding process. On the other hand, if there is no free core, the process proceeds to Step SF4 to determine if there is a free space in the buffer, and then, the process proceeds to Step SF5 to temporarily store image data in the buffer if there is a free space in the buffer. If there is no free space in the buffer, the process proceeds to Step SF6 to wait for generation of a free space in the buffer or a free core. Then, if there is a free space in the buffer, the image data is stored there. If there is a free core, the core is instructed to execute the decoding process.

Since the capacity of the buffer is limited, it is conceivable that there may be some time between image generation processes. If the time between image generation processes becomes long, there is a case where the workpiece W passes during that time, and thus, the fixed interval imaging mode is preferable. In some cases, however, the operation mode as illustrated in the timing chart of FIG. 19 is also possible.

In addition, when a decoding process of any core is completed among the cores executing the decoding processes, all the decoding processes of the other cores can be also terminated. FIG. 22 illustrates a case where a decoding process D4 of the read image generated by the fourth read image generation process C4 is completed in the core CR1. When this decoding process is complete, a decoding process D5 of the read image generated by the fifth read image generation process C5 being executed by the core CR2 is stopped, and a decoding process D6 of the read image generated by the sixth read image generation process C6 is not executed. A decoding result obtained by the decoding process D4 is output at the same time as the decoding process D5 is stopped or after the decoding process D5 is stopped.

That is, when each of the plurality of cores CR1 to CR3 executes the decoding process of each of read images, the timing at which the decoding process is completed is usually different. For example, the decoding result is obtained when the decoding process is completed in the core CR1, there is no point in continuing the decoding process by the other cores CR2 and CR3 thereafter. In such a case, the decoding processes of the cores CR2 and CR3 can be stopped.

Specifically, a start timing of the flowchart of FIG. 23 is the timing at which the optical reading device 1 receives the reading start trigger signal, the read image is generated in Step SG1 after the start, whether there is a free core is determined in Step SG2, and then, the process proceeds to Step SG3 if there is a free core, and the free core is instructed to execute the decoding process. If there is no free core, the process proceeds to Step SG4 and waits for generation of a free core for a predetermined time, and then, returns to the start. In Step SG5, it is determined whether or not the decoding process has been completed in any of the cores. The process returns to the start. If the decoding process has not been completed in any of the cores, or proceeds to Step SG6 to end the decoding process in all the cores if the decoding process has been completed in any of the cores. As a result, a standby state can be set in preparation for reception of the next reading start trigger signal.

FIG. 24 is a timing chart in a case where a plurality of read images generated by changing the brightness of the illumination unit 4 are subjected to decoding processes. The brightness of the illumination unit 4 is set to “10” in the first, third, and fifth read image generation processes C1, C3, and C5, and the brightness of the illumination unit 4 is set to “20” in the second, fourth, and sixth read image generation processes C2, C4, and C6. Regarding the brightness, “20” is brighter than “10”. That is, the imaging unit 5 captures images of the workpiece W under different imaging conditions to generate a first read image (read image generated by the first, third, and fifth read image generation processes C1, C3, and C5) and a second read image (read image generated by the second, fourth, and sixth read image generation processes C2, C4, and C6).

The core CR0 subjects the read image generated by the first read image generation process C1 and the read image generated by the second read image generation process C2, generated under different imaging conditions, to decoding processes by the different cores CR1 and CR2, respectively. In addition, the core CR0 subjects the read image generated by the third read image generation process C3 and the read image generated by the fourth read image generation process C4, generated under different imaging conditions, to decoding processes by the different cores CR3 and CR1, respectively.

FIG. 25 is a timing chart in a case where different types of codes (one-dimensional code and two-dimensional code) included in a plurality of read images generated by changing brightness of the illumination unit 4 are subjected to decoding processes by different cores. In this example, it is assumed a case where, for example, a one-dimensional code (CODE128) and a two-dimensional code (QR) are attached to the workpiece W, and the two-dimensional code is farther than the one-dimensional code. In this case, the brightness of the illumination unit 4 is set to “10”, and the first, third, and fifth read image generation processes C1, C3, and C5 are executed with the brightness suitable for capturing an image of a relatively close one-dimensional code. On the other hand, as the brightness suitable for capturing an image of a relatively distant two-dimensional code, the brightness of the illumination unit 4 is set to “20”, and the second, fourth, and sixth read image generation processes C2, C4, and C6 are executed. At this time, the first, third, and fifth read image generation processes C1, C3, and C5 may be executed according to the imaging parameters of Bank 1 illustrated in FIG. 8, and the second, fourth, and sixth read image generation processes C2, C4, and C6 may be executed according to the imaging parameters of Bank 2.

The core CR0 subjects the read image generated by the first read image generation process C1 and the read image generated by the second read image generation process C2, generated with different imaging conditions, to decoding processes by the cores CR1 and CR2, respectively. The core CR1 executes the decoding process of the one-dimensional code, and the core CR2 executes the decoding process of the two-dimensional code. In addition, the core CR0 subjects the read image generated by the third read image generation process C3 and the read image generated by the fourth read image generation process C4, generated with different imaging conditions, to decoding processes by the cores CR3 and CR1, respectively. The core CR3 executes the decoding process of the one-dimensional code, and the core CR1 executes the decoding process of the two-dimensional code.

In addition, the imaging unit 5 can also capture images of the workpiece W under different decoding conditions to generate a first read image and a second read image similarly to the case where the imaging conditions are different. In this case as well, the core CR0 can instruct different cores to execute decoding processes of the first read image and the second read image generated under the different decoding conditions.

[Operation of Optical Reading Device 1]

FIG. 26 illustrates the processing during the operation time of the optical reading device 1. During the operation time of the optical reading device 1, Step SH1 is started when the reading start trigger signal is received. In Step SH1, the imaging unit 5 captures an image of the workpiece W. In Step SH2, a read image is generated from image data obtained by imaging in Step SH1 and output to the pre-processing circuit 30. At this time, the image data for each line is input to the pre-processing circuit 30. Note that, instead of the image data for each line, image data for a plurality of lines or the entire image data constituting one read image may be input to the pre-processing circuit 30.

In Step SH3, the pre-processing circuit 30 executes pre-processing such as a gradation conversion process and various image filtering processes on the image data, and a pre-processed image is generated in Step SH4. Thereafter, the process proceeds to Step SH5, and a characteristic amount indicating the likelihood of a code is calculated for each area in pre-processed image data based on a brightness value of each pixel in the pre-processed image data, and the brightness value according to the calculated characteristic amount is assigned to generate a heat map image (code search data) illustrated in FIGS. 10B and 10C. In this process, edge data generation, an edge data integration process, and the like are executed. After generating the code search data, the process proceeds to Step SH6 to output the code search data to the processor 40.

The processor 40 executes a code search process using the code search data in Step SH7. That is, when the code search data is the heat map image illustrated in FIGS. 10B and 10C, an area having a high brightness value corresponds to the code candidate area, and thus, the processor 40 searches for the area having the high brightness value in the heat map image.

In Step SE18, the code candidate area is determined. Thereafter, the process proceeds to Step SE19, and the core CR0 of the processor 40 instructs the cores CR1 to CR8 to execute decoding processes. After the decoding processes, a decoding result is acquired in Step SH10 and output to an external device.

[User Interface Image]

FIG. 27 is a view illustrating an example of the user interface image 300, and illustrates a case where the reading tab 301 is selected from among the plurality of tabs 301, 302, and 303. The user interface image 300 is provided with a read image display area 304 that displays a read image captured by the imaging unit 5 and a tuning result display area 305 that displays a tuning result. In the tuning result display area 305, for example, a graph illustrating the relationship between the ease of reading and brightness is displayed.

[Function and Effect of Embodiment]

As described above, according to the present embodiment, the characteristic amount indicating the likelihood of the code is calculated while capturing the image data for each line from the imaging unit 5, the code candidate area is determined based on this characteristic amount, and the decoding process of the determined area is executed. Thus, it is unnecessary to wait until scanning of the entire image ends to search for the code, and it is possible to perform the capturing of the image data from the imaging unit 5, the calculation of the characteristic amount, and the determination of the code candidate area in parallel. As a result, the output timing of the decoding result can be accelerated even if the size of the read image is large.

In addition, the decoding processes can be executed simultaneously on a plurality of cores among the cores CR1 to CR8. In other words, the plurality of cores can simultaneously execute the decoding processes on the read images instructed at different timings, and thus, the decoding process of the plurality of read images is speeded up while securing a sufficient decoding processing time for one read image and enabling stable reading. As a result, the reading result can be obtained at high speed, and the reading result can be output immediately after the generation of the read image.

The above-described embodiments are merely examples in all respects, and should not be construed as limiting. Further, all modifications and changes belonging to the equivalent range of the claims fall within the scope of the present aspect.

As described above, the optical reading device according to the present aspect can be used, for example, in the case of reading the code such as the bar code and the two-dimensional code attached to the workpiece. 

1-11. (canceled)
 12. An optical reading device that reads a code attached to a workpiece, the optical reading device comprising: an illumination unit that emits light toward an area through which the workpiece passes; an imaging unit configured to receive the light emitted from the illumination unit and reflected from the area through which the workpiece passes, to generate a read image obtained by capturing an image of the area through which the workpiece passes, and to transfer the read image line by line; a pre-processing circuit that executes pre-processing of image data each time a predetermined number of lines of the image data is taken from the imaging unit, and calculates a characteristic amount indicating likelihood of the code for each area in the pre-processed image data based on a brightness value of each pixel in the pre-processed image data; a processor that acquires the characteristic amount calculated by the pre-processing circuit, determines a code candidate area in the read image based on the acquired characteristic amount, and executes a decoding process of the code candidate area to generate a decoding result; and an output unit that outputs the decoding result generated by the processor, wherein the predetermined number of lines is an arbitrary number of lines of one or more, and is the number of lines required to detect the likelihood of the code, and the predetermined number of lines of image data is data forming a partial area of the read image generated by the imaging unit.
 13. The optical reading device according to claim 12, wherein the processor includes a first core that instructs a decoding process of the code candidate area and a plurality of second cores that execute the decoding process on the code candidate area instructed by the first core; and the first core instructs the second core, which is presumed to be capable of immediately executing the decoding process or executing a decoding process next to the decoding process being currently executed, to execute the decoding process, and the plurality of the second cores are configured to be capable of simultaneously performing a decoding process on the read images instructed by the first core at different timings.
 14. The optical reading device according to claim 13, wherein the second core acquires the read image instructed by the first core and executes the decoding process on the code candidate area of the read image.
 15. The optical reading device according to claim 13, wherein the pre-processing circuit generates a characteristic amount image to which the brightness value corresponding to the calculated characteristic amount is assigned after calculating the characteristic amount, and the processor acquires the characteristic amount image generated by the pre-processing circuit, and determines the code candidate area based on the acquired characteristic amount image.
 16. The optical reading device according to claim 15, wherein the second core acquires the read image instructed by the first core, and executes the decoding process on the code candidate area of the read image which is determined based on the characteristic amount image corresponding to the read image.
 17. The optical reading device according to claim 15, wherein the pre-processing circuit calculates a first characteristic amount indicating likelihood of a first code and a second characteristic amount indicating a likelihood of a second code, and then, generates a first characteristic amount image to which a brightness value corresponding to the first characteristic amount is assigned and a second characteristic amount image to which a brightness value corresponding to the second characteristic amount is assigned, and the processor determines a first code candidate area for the first code based on the first characteristic amount image generated by the pre-processing circuit, determines a second code candidate area for the second code based on the second characteristic amount image, and executes a decoding process of each of the first and second code candidate areas to generate a decoding result.
 18. The optical reading device according to claim 17, wherein one of the plurality of the second cores acquires the first characteristic amount image and another of the plurality of the second cores acquires the second characteristic amount image, and each of the one and another of the plurality of the second cores executes the decoding processes based on the first and second characteristic amount images, respectively.
 19. The optical reading device according to claim 17, wherein each of the plurality of the second cores has a first decoding processing unit that acquires the first characteristic amount image and a second decoding processing unit that acquires the second characteristic amount image, the first decoding processing unit executes a decoding process on the first candidate area for the first code determined based on the first characteristic amount image, and the second decoding processing unit executes a decoding process on the second candidate area for the second code determined based on the second characteristic amount image.
 20. The optical reading device according to claim 17, wherein the first code is a one-dimensional code, and the second code is a two-dimensional code.
 21. The optical reading device according to claim 12, wherein the pre-processing circuit executes at least one of a gradation conversion process and a filtering process as the pre-processing. 